package jtk.project4.fleet.field;

import javax.swing.SortOrder;

import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.TableField;
import nl.coderight.jazz.form.field.TableField.AutoResizeMode;

public class PurchaseOrder1Field extends GroupControl{
	private TableField<String> PurchaseOrderTable;
	
	public PurchaseOrder1Field(String bindID){
		setBindID(bindID);
		createFields();
		createLayout();
	}
	
	private void createFields(){
		//setup table
		PurchaseOrderTable = new TableField<String>("PurchaseOrder","PurchaseOrder");
		PurchaseOrderTable.setTitle("PurchaseOrder.header.table");
		//PurchaseOrderTable.setAutoResizeMode(AutoResizeMode.OFF);
		PurchaseOrderTable.getSelectionValues();
		
		//add columns
		PurchaseOrderTable.addColumn("label.noPart","noPart");
		PurchaseOrderTable.addColumn("label.comment","comment");
		PurchaseOrderTable.addColumn("label.quantityOrdered","quantityOrdered");
		PurchaseOrderTable.addColumn("label.quantityReceived","quantityReceived");
		PurchaseOrderTable.addColumn("label.Received","Received");
		PurchaseOrderTable.addColumn("label.unitCost","unitCost");
		PurchaseOrderTable.addColumn("label.extendedCost","extendedCost");
		//sort
		PurchaseOrderTable.sort("noPart", SortOrder.ASCENDING);
	}
	
	private void createLayout() {
		setLayout(new FormLayout())
		.addField(PurchaseOrderTable)
		.addRow()
		;
	}
}